package demo.threadpool;

public class Main {
	public static void main(String[] args) {
		ThreadPool pool = new ThreadPool(5);
		
		int i = 0;
		while(true){
			i++;
			WorkerThread worker = pool.getWorker();
			if(worker == null){
				System.out.println("没有空闲工人");
			}else{
				Job job = new Job("任务" + i);
				worker.setJob(job);
			}
			
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
}
